From 50a0f0240d7fef133eb5acc1bea2b1168b08e9db Mon Sep 17 00:00:00 2001 From: Factiven Date: Sun, 24 Dec 2023 13:03:54 +0700 Subject: migrate to typescript --- pages/en/manga/[...id].js | 427 ---------------------------------------------- 1 file changed, 427 deletions(-) delete mode 100644 pages/en/manga/[...id].js (limited to 'pages/en/manga/[...id].js') diff --git a/pages/en/manga/[...id].js b/pages/en/manga/[...id].js deleted file mode 100644 index 5648b2c..0000000 --- a/pages/en/manga/[...id].js +++ /dev/null @@ -1,427 +0,0 @@ -import ChapterSelector from "@/components/manga/chapters"; -import Footer from "@/components/shared/footer"; -import Head from "next/head"; -import { useEffect, useState } from "react"; -import { getServerSession } from "next-auth"; -import { authOptions } from "../../api/auth/[...nextauth]"; -import { mediaInfoQuery } from "@/lib/graphql/query"; -import Modal from "@/components/modal"; -import { signIn, useSession } from "next-auth/react"; -import AniList from "@/components/media/aniList"; -import ListEditor from "@/components/listEditor"; -import MobileNav from "@/components/shared/MobileNav"; -import Image from "next/image"; -import DetailTop from "@/components/anime/mobile/topSection"; -import Characters from "@/components/anime/charactersCard"; -import Content from "@/components/home/content"; -import { toast } from "sonner"; -import axios from "axios"; -import getAnifyInfo from "@/lib/anify/info"; -import { redis } from "@/lib/redis"; -import getMangaId from "@/lib/anify/getMangaId"; - -export default function Manga({ info, anifyData, color, chapterNotFound }) { - const [domainUrl, setDomainUrl] = useState(""); - const { data: session } = useSession(); - - const [loading, setLoading] = useState(false); - const [progress, setProgress] = useState(0); - const [statuses, setStatuses] = useState(null); - const [watch, setWatch] = useState(); - - const [chapter, setChapter] = useState(null); - - const [open, setOpen] = useState(false); - - const rec = info?.recommendations?.nodes?.map( - (data) => data.mediaRecommendation - ); - - useEffect(() => { - setDomainUrl(window.location.origin); - }, []); - - useEffect(() => { - if (chapterNotFound) { - toast.error("Chapter not found"); - const cleanUrl = window.location.origin + window.location.pathname; - window.history.replaceState(null, null, cleanUrl); - } - }, [chapterNotFound]); - - useEffect(() => { - async function fetchData() { - try { - setLoading(true); - - const { data } = await axios.get(`/api/v2/info?id=${anifyData.id}`); - - if (!data.chapters) { - setLoading(false); - return; - } - - setChapter(data); - setLoading(false); - } catch (error) { - console.error(error); - } - } - fetchData(); - - return () => { - setChapter(null); - }; - }, [info?.id]); - - function handleOpen() { - setOpen(true); - document.body.style.overflow = "hidden"; - } - - function handleClose() { - setOpen(false); - document.body.style.overflow = "auto"; - } - - return ( - <> - - - {info - ? `Manga - ${ - info.title.romaji || info.title.english || info.title.native - }` - : "Getting Info..."} - - - - - - - - handleClose()}> -
- {!session && ( -
-
- Edit your list -
- -
- )} - {session && info && ( - - )} -
-
- -
- {/*
*/} -
-
- {info?.bannerImage && ( - banner anime - )} -
-
- - - {!loading ? ( - chapter?.chapters?.length > 0 ? ( - - ) : ( -
-

- Oops!

It looks like this manga is not available. -

-
- ) - ) : ( -
-
-
-
-
-
-
-
- )} - - {info?.characters?.edges?.length > 0 && ( -
- -
- )} - - {info && rec && rec?.length !== 0 && ( -
- -
- )} -
-
-